<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>父组件向子组件传值</title>
</head>
<body>
<div id="app">
    <cpn v-bind:mv="movies"></cpn>
</div>

<template id="cpn">
    <h2>流行电影</h2>
    <ul>
        <li v-for="(item, index) in mv">{{ item }}</li>

        <hr>
        <li v-for="(item, index) in 'abcdefg'">{{ item }}</li>
    </ul>
</template>

<script type="module">
    import {createApp, reactive, defineComponent} from "../../../../js/vue.esm-browser.js";

    let component = defineComponent(
        {
            template: "#cpn",
            setup() {
                return {};
            },
            // 使用 props 选项接收从外部定义的数据
            props: ["mv"],

        }
    );

    let app = createApp({
        setup() {
            let movies = ["长津湖", "无价之宝", "流浪地球"]

            return {
                movies,
            }
        },

        components: {
            cpn: component,
        }
    })

    app.mount("#app")
</script>
</body>
</html>